import instance from "./instance.js";
import {clearObject} from "../../utils/index.js";

// 获取所有已关注的股票信息
export const getUserAll = (user_id) => {
  return instance.get("/gp/getallgp", {params: {user_id}})
}
// 添加监控的股票
export const addGuPiao = (user_id, gupiao_id, price_buy, price_sell_high, price_sell_low) => {
  return instance.get("/gp/addgp", {
    params: clearObject({
      user_id,
      gupiao_id,
      price_buy,
      price_sell_high,
      price_sell_low
    })
  })
}
// 修改股票的属性和购买状态
export const updateUserGuPiao = (user_id, gupiao_id, price_buy, price_sell_high, price_sell_low, do_it) => {
  return instance.get("/gp/updategp", {
    params: clearObject({
      user_id,
      gupiao_id,
      price_buy,
      price_sell_high,
      price_sell_low,
      do_it
    })
  })
}
// 删除股票监控
export const deleteUserGuPiao = (user_id,gupiao_id) => {
  return instance.get("/gp/deletegp", {params: {user_id,gupiao_id}})
}
